#ifndef __CORE_READFILE_H__
#define __CORE_READFILE_H__
#include "Vector2.h"
#include "Vector3.h"
#include "Vector4.h"
#include "Matrix3.h"
#include "Matrix4.h"
#include <string>

namespace Core
{
	enum FileSeekOrigin
	{
		FILE_SEEK_CUR,
		FILE_SEEK_END,
		FILE_SEEK_SET
	};

	class rtReadFile
	{
	public:
		rtReadFile(std::string& fileName);
		virtual ~rtReadFile(void);

		virtual int length() const;
		virtual int tell() const;
		virtual int seek(long offset, FileSeekOrigin mode);
		virtual void flush();
		virtual void rewind();
		virtual int read(void* buf, int len);

		virtual int readInt(int& value);
		virtual int readUnsignedInt(unsigned int& value);
		virtual int readShort(short& value);
		virtual int readUnsignedShort(unsigned short& value);
		virtual int readChar(char& value);
		virtual int readUnsignedChar(unsigned char& value);
		virtual int readByte(unsigned char& value);
		virtual int readFloat(float& value);
		virtual int readBool(bool& value);
		virtual int readString(std::string& value);
		virtual int readVector2(rtVector2& value);
		virtual int readVector3(rtVector3& value);
		virtual int readVector4(rtVector4& value);
		virtual int readMatrix3(rtMatrix3& value);
		virtual int readMatrix4(rtMatrix4& value);

		template<typename T>
		inline int readData(T& value)
		{
			return read(&value, sizeof(T));
		}

		template<typename T>
		inline int readArrayData(T* value, int count)
		{
			return read(value, sizeof(T) * count);
		}
	};
}

#endif
